package hud;

import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Separator;
import javafx.scene.control.SeparatorMenuItem;

public class ContextMenuMan {
    private static ContextMenuMan instance;
    private ContextMenu databaseContextMenu;
    private ContextMenuMan() {

    }

    public static ContextMenuMan getInstance() {
        if (instance == null) {
            instance = new ContextMenuMan();
        }
        return instance;
    }

    public ContextMenu getDatabaseContexMenu() {
        if (databaseContextMenu == null) {
            databaseContextMenu = new ContextMenu();

            MenuItem menuItem = new MenuItem("Open Shell");
            databaseContextMenu.getItems().add(menuItem);

            menuItem = new MenuItem("Refresh");
            databaseContextMenu.getItems().add(menuItem);

            SeparatorMenuItem separatorMenuItem = new SeparatorMenuItem();
            Separator separator = new Separator();
            separatorMenuItem.setContent(separator);
            databaseContextMenu.getItems().add(separatorMenuItem);

            menuItem = new MenuItem("Database Statistic");
            databaseContextMenu.getItems().add(menuItem);

            separatorMenuItem = new SeparatorMenuItem();
            separator = new Separator();
            separatorMenuItem.setContent(separator);
            databaseContextMenu.getItems().add(separatorMenuItem);

            menuItem = new MenuItem("Current Operations");
            databaseContextMenu.getItems().add(menuItem);

            menuItem = new MenuItem("Kill Operation...");
            databaseContextMenu.getItems().add(menuItem);

            separatorMenuItem = new SeparatorMenuItem();
            separator = new Separator();
            separatorMenuItem.setContent(separator);
            databaseContextMenu.getItems().add(separatorMenuItem);

            menuItem = new MenuItem("Repair Database");
            databaseContextMenu.getItems().add(menuItem);

            menuItem = new MenuItem("Drop Database");
            databaseContextMenu.getItems().add(menuItem);
        }
        return databaseContextMenu;
    }
}
